package com.rtx.wms.customer.ris;

import javax.annotation.Resource;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.rtx.edi.model.api.bo.ApiMappingInfoBo;
import com.rtx.edi.platform.synctask.service.GatWayService;
import com.rtx.wms.customer.common.call.CallRisAPIService;

/**
 * 通过对接场景编码调用一次RISWMS接口逻辑
 * @author Administrator
 *
 */
public abstract class CallRisAPI implements CallRisAPIService{
	
	@Resource(name = "RisGatWayService")
	GatWayService gatWayService;

	protected abstract void resolveResonse(String response,Object data);

	@Override
	public void callRisWMSAPI(Object data,ApiMappingInfoBo bo) {
		//转换源数据
		String sourceJSON = JSON.toJSONString(data, SerializerFeature.WriteDateUseDateFormat);
		
		//调用API
		String result = gatWayService.handel(bo.getApimappingcode(), sourceJSON);
		
		//解析响应报文
		resolveResonse(result,data);
	}
}
